import Vue from 'vue'
import App from './App'
import uView from "uview-ui";
import store from './store/index.js'
import moment from 'moment'
import lodash from 'lodash'

import {
	isPhone,isWinchatClient
} from '@/utils/utilFun.js'

import PullRefreshView from '@/components/PullRefreshView.vue'
import OpenCellButton from '@/components/OpenCellButton.vue'
import Qrcode from '@/components/tki-qrcode/tki-qrcode.vue'
import plateInput from '@/components/uni-plate-input/uni-plate-input.vue';
import HandUser from '@/components/HandUser/index' //顶部用户信息组件

Vue.use(uView);

Vue.config.productionTip = false;

// uni.$u.config.unit = 'rpx'

Vue.component('PullRefreshView', PullRefreshView); //下拉加载
Vue.component('OpenCellButton', OpenCellButton); //授权按钮插槽，任何使用此插槽的模块，都可以直接使用微信内置授权
Vue.component('Qrcode',Qrcode)  //二维码生成组件
Vue.component('plateInput',plateInput)  //车牌输入组件，https://ext.dcloud.net.cn/plugin?id=693
Vue.component('HandUser',HandUser)

/* 自定义toast */
Vue.prototype.$toast = function(text, icon = 'none', duration = 1000) {
	return new Promise(resolve => {
		uni.showToast({
			title: text,
			icon,
		})

		setTimeout(() => {
			resolve()
		}, duration)
	})
}

/* 自定义弹框 */
Vue.prototype.$confirm = function(text) {
	return new Promise(resolve => {
		uni.showModal({
			title: text,
			success(res) {
				if (res.confirm) {
					resolve()
				}
			}
		})
	})
}

Vue.prototype.$moment = moment;
Vue.prototype.$lodash = lodash;

App.mpType = 'app'

const app = new Vue({
	...App,
	store
})
app.$mount()
